home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / tclMotif-1.4 / doc / examples / fonts.tcl < prev    next >
Text File  |  1995-06-29  |  1KB  |  47 lines

  1. #! moat
  2. #
  3. # Font selection demo.
  4. ################# Create the interface ###################
  5. xtAppInitialize
  6.  
  7. xmForm .top managed \
  8.     -marginHeight 10 -marginWidth 10 \
  9.     -spacing 10 \
  10.  
  11. xmScrolledList .top.fonts managed \
  12.     -visibleItemCount 10 \
  13.     -listSizePolicy variable
  14.  
  15. xmLabel .top.text managed \
  16.     -topAttachment widget_atachment -topWidget .top.fonts \
  17.     -labelString "\
  18. THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG,
  19. the quick brown fox jumps over the lazy dog.
  20. 0123456789"
  21.  
  22. .top.fonts defaultActionCallback {
  23.     puts "Selecting font %item"
  24.     .top.text setValues -fontList "%item"
  25. }
  26.  
  27. xmPushButton .top.quit managed \
  28.     -x 200 -y 250 \
  29.     -labelString "Quit"
  30. .top.quit activateCallback {exit 0}
  31.  
  32. ############### Read font list ##############################
  33.  
  34. set font [open "/usr/lib/X11/fonts/75dpi/fonts.dir" r]
  35. set fonts {}
  36. foreach line [lrange [split [read $font nonewline] "\n"] 1 1000] {
  37.     set f [lrange $line 1 100]
  38.     lappend fonts $f
  39. }
  40. foreach f [lsort $fonts] {
  41.     .top.fonts addItem $f 0
  42. }
  43. #############################################################
  44.  
  45. . realizeWidget
  46. . mainLoop
  47.